from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class gui_fake :
    def __init__ ( self ) :
        self . _any_key_event = None
        self . _global_mouse_button_1_event = None
        self . _key_backspace_event = None
        self . _key_space_event = None
        self . _key_f5_event = None
        self . _key_ctrl_f5_event = None
        self . _key_escape_event = None
        self . _key_return_event = None
        self . _mouse_button_1_event = None
        self . _focus_in = None
        self . _focus_out = None
        self . _gui_key_up_event_request = None
        self . _gui_key_down_event_request = None
        self . _gui_key_return_event_request = None
        self . _gui_key_escape_event_request = None
        self . _gui_key_space_event_request = None
        self . _gui_key_backspace_event_request = None
        self . _gui_key_ctrl_f5_event_request = None
        self . _gui_mouse_button_1_event_request = None
        self . _gui_global_mouse_button_1_event_request = None
        self . _gui_any_key_event_request = None
        self . _gui_focus_in_event_request = None
        self . _gui_focus_out_event_request = None
    def gui_key_up_event_request ( self , widget , handler ) :
        self . _gui_key_up_event_request = [ widget , handler ]
    def gui_key_down_event_request ( self , widget , handler ) :
        self . _gui_key_down_event_request = [ widget , handler ]
    def gui_key_backspace_event_request ( self , widget , handler ) :
        self . _gui_key_backspace_event_request = [ widget , handler ]
    def gui_key_space_event_request ( self , widget , handler ) :
        self . _gui_key_space_event_request = [ widget , handler ]
    def gui_key_f5_event_request ( self , widget , handler ) :
        self . _gui_key_f5_event_request = [ widget , handler ]
    def gui_key_return_event_request ( self , widget , handler ) :
        self . _gui_key_return_event_request = [ widget , handler ]
    def gui_key_escape_event_request ( self , widget , handler ) :
        self . _gui_key_escape_event_request = [ widget , handler ]
    def gui_key_ctrl_f5_event_request ( self , widget , handler ) :
        self . _gui_key_ctrl_f5_event_request = [ widget , handler ]
    def gui_mouse_button_1_event_request ( self , widget , handler ) :
        self . _gui_mouse_button_1_event_request = [ widget , handler ]
    def gui_global_mouse_button_1_event_request ( self , widget , handler ) :
        self . _gui_global_mouse_button_1_event_request = [ widget , handler ]
    def gui_any_key_event_request ( self , widget , handler ) :
        self . _gui_any_key_event_request = [ widget , handler ]
    def gui_focus_in_event_request ( self , widget , handler ) :
        self . _gui_focus_in_event_request = [ widget , handler ]
    def gui_focus_out_event_request ( self , widget , handler ) :
        self . _gui_focus_out_event_request = [ widget , handler ]

class mediator_gui_events_tests : 
    'mediator_gui_events'
    def __init__ ( self , test ) :
        self . _test = test
        self . _gui = gui_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'gui' 
            , self . _gui 
            , None
            ) )
    def test_gui_key_up_event_request ( self ) :
        self . _mediator . gui_key_up_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_key_up_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_key_down_event_request ( self ) :
        self . _mediator . gui_key_down_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_key_down_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_key_return_event_request ( self ) :
        self . _mediator . gui_key_return_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_key_return_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_key_escape_event_request ( self ) :
        self . _mediator . gui_key_escape_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_key_escape_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_key_backspace_event_request ( self ) :
        self . _mediator . gui_key_backspace_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_key_backspace_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_key_space_event_request ( self ) :
        self . _mediator . gui_key_space_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_key_space_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_key_f5_event_request ( self ) :
        self . _mediator . gui_key_f5_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_key_f5_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_key_ctrl_f5_event_request ( self ) :
        self . _mediator . gui_key_ctrl_f5_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_key_ctrl_f5_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_mouse_button_1_event_request ( self ) :
        self . _mediator . gui_mouse_button_1_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_mouse_button_1_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_global_mouse_button_1_event_request ( self ) :
        self . _mediator . gui_global_mouse_button_1_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_global_mouse_button_1_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_any_key_event_request ( self ) :
        self . _mediator . gui_any_key_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_any_key_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_focus_in_event_request ( self ) :
        self . _mediator . gui_focus_in_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_focus_in_event_request , [ 'my widget' , 'my handler' ] )
    def test_gui_focus_out_event_request ( self ) :
        self . _mediator . gui_focus_out_event_request ( 'my widget' , 'my handler' )
        self . _test . assume_equal ( self . _gui . _gui_focus_out_event_request , [ 'my widget' , 'my handler' ] )
